﻿using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TemplatesPrint.DBHelper;
using TemplatesPrint.Entitys;
using TemplatesPrint.Tools;

namespace TemplatesPrint.EntityHandle
{
   public  class TaskInfoHandle
    {
       public  static void SaveTaskHistory(string id,TaskInfoEntity task)
        {
            using (var db = SQLiteHelper.GetInstance())
            {
                var task_old = new TaskInfoHistoryEntity();
                task_old.Id = id;
                task_old.MsgId = task.MsgId;
                task_old.Status =task.Status;
                task_old.Source = task.Source;
                task_old.Type = task.Type;
                task_old.Printcopies = task.Printcopies.ToString();
                task_old.PrinterInfo = task.PrinterInfo;
                task_old.TemplateInfo = task.TemplateInfo;

                task_old.Data = task.Data;
               
                task_old.CreateTime = task.CreateTime;
                task_old.UpdateTime = task.UpdateTime;
                task_old.StartTime = task.StartTime;
                task_old.EndTime = task.EndTime;
                task_old.ExInfo = task.ExInfo;
                db.Insertable(task_old).ExecuteCommand();
            };
        }
    }
}
